<template>
  <div class="flex items-center">
    <span> 告警开关 </span>
    <van-switch class="ml-2" size="20" v-model="checked" @change="onChange" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      checked: false,
    }
  },
  created() {
    this.checked = this.$store.state.alarm
  },
  methods: {
    onChange(val) {
      this.$store.commit('setAlarm', val)
    },
  },
}
</script>

<style>
</style>